package com.party.core.dao.read.competition;

import com.party.common.paging.Page;
import com.party.core.dao.read.BaseReadDao;
import com.party.core.model.competition.CompetitionResult;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 参赛人员成绩
 *
 * @author Administrator
 */
@Repository
public interface CompetitionResultReadDao extends BaseReadDao<CompetitionResult> {

    /**
     * 项目所有人员排名
     *
     * @param params
     * @param page
     * @return
     */
    List<Map<String, Object>> getAllResult(@Param(value = "params") Map<String, Object> params, Page page);

    /**
     * 项目小组排名
     *
     * @param params
     * @param page
     * @return
     */
    List<Map<String, Object>> getByGroup(@Param(value = "params") Map<String, Object> params, Page page);

    /**
     * 项目小组所有人员排名
     *
     * @param params
     * @param page
     * @return
     */
    List<Map<String, Object>> getGroupAllPersonResult(@Param(value = "params") Map<String, Object> params, Page page);

    Map<String, Object> getTotalDistanceAndResult(@Param(value = "params") Map<String, Object> params);

    List<Map<String, Object>> getScheduleRank(CompetitionResult cResult);

    /**
     * 获取用户成绩
     *
     * @param cMemberId  关系表id
     * @param openStatus 开放状态 1:开 0：关
     * @param scheduleId 赛程编号
     * @return
     */
    List<CompetitionResult> findByMemberId(@Param(value = "cMemberId") String cMemberId, @Param(value = "openStatus") Integer openStatus, @Param("scheduleId") String scheduleId);

    Map<String,Object> findBySchedule(@Param(value = "scheduleId") String scheduleId, @Param(value = "cMemberIds") List<String> cMemberIds);
}
